package de.jonasbs.breakblock.res;

import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;

public enum ResGraphics {
	BACKGROUND("background.png"),
	ICON("icon.png");

	Image myImage;

	ResGraphics(String imgFileName) {

		imgFileName = "img/" + imgFileName;
		System.out.println("Image loading: " + imgFileName);

		try {
			myImage = ImageIO.read(this.getClass().getResource(imgFileName));
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	// Play or Re-play the sound effect from the beginning, by rewinding.
	public Image getImage() {
		return myImage;
	}

	// Optional static method to pre-load all the sound files.
	static void init() {
		values(); // calls the constructor for all the elements
	}
}
